// 获取url指定过的参数
export function getUrlParams (value) {
  var url = window.location.search
  if (url.indexOf('?') === 1) { return false }
  url = url.substr(1)
  url = url.split('&')
  var name = value || ''
  var nameres
  // 获取全部参数及其值
  for (var i = 0; i < url.length; i++) {
    var info = url[i].split('=')
    var obj = {}
    obj[info[0]] = decodeURI(info[1])
    url[i] = obj
  }
  // 如果传入一个参数名称，就匹配其值
  if (name) {
    for (var a = 0; a < url.length; a++) {
      for (const key in url[a]) {
        if (key === name) {
          nameres = url[a][key]
        }
      }
    }
  } else {
    nameres = url
  }
  // 返回结果
  return nameres
}
